// components/tab-control/tab-control.js
Component({
  properties: {
    titles: {
      type: Array,
      value: []
    }
  },
  data: {
    currIndex: 0
  },
  methods: {
    handleItemClick(event){
      console.log(event)
      const index = event.currentTarget.dataset.index
      this.setData({
        currIndex: index
      })
      this.triggerEvent('itemClick', {index, title: this.properties.titles[index]}, {})
    }
  }
})
